using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using Entities;
using DAL;
using System.Data.SqlClient;
using System.Data;

namespace BUS
{
    public class tbNhanVienBUS
    {
        public static void Insert(tbNhanVienEntities NV)
        {
            tbNhanVienDAL NVDAL = new tbNhanVienDAL();
            NVDAL.Insert(NV);
        }

        public static void Update(tbNhanVienEntities NV)
        {
            tbNhanVienDAL NVDAL = new tbNhanVienDAL();
            NVDAL.Update(NV);
        }

        public static void Delete(int iD)
        {
            tbNhanVienDAL NVDAL = new tbNhanVienDAL();
            NVDAL.Delete(iD);
        }

        public static Entities.tbNhanVienEntities.tbNhanVienColection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbNhanVienDAL NVDAL = new tbNhanVienDAL();
            return NVDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }

        public static Entities.tbNhanVienEntities.tbNhanVienColection GetAll()
        {
            int total = 0;
            tbNhanVienDAL NVDAL = new tbNhanVienDAL();
            return NVDAL.Get("where 1=1", 0, 0, Entities.tbNhanVienEntities.tbNhanVienColumn.MaNV.ToString(), "ASC", out total);
        }

        public static tbNhanVienEntities GetByID(int iD)
        {
            int total = 0;
            tbNhanVienDAL NVDAL = new tbNhanVienDAL();
            Entities.tbNhanVienEntities.tbNhanVienColection NVCollection = NVDAL.Get("where " + Entities.tbNhanVienEntities.tbNhanVienColumn.MaNV.ToString() + "=" + iD.ToString(), 0, 0, Entities.tbNhanVienEntities.tbNhanVienColumn.MaNV.ToString(), "ASC", out total);
            if (NVCollection.Count > 0)
                return NVCollection[0];
            return null;
        }

        public static Boolean KTNhanVien(string user, string pass)
        {
            tbNhanVienDAL nhanVienDAL = new tbNhanVienDAL();
            return nhanVienDAL.KTNhanVien(user, pass);
        }
        public static Boolean KTNhanVien2(string user)
        {
            tbNhanVienDAL nhanVienDAL = new tbNhanVienDAL();
            return nhanVienDAL.KTNhanVien2(user);
        }
    }
}
